package han.cirno.corrupt.components.school.class_time

import han.cirno.corrupt.components.calendar.CalendarUtil

class SimpleClassTime: ClassTime {
    private val times=ArrayList<Pair<Long,Long>>()

    override fun getTime(serial: Int): Pair<Long, Long> {
        return times[serial]
    }
    override fun getSerialLength(): Int {
        return times.size
    }

    class Builder{
        private val simpleClassTime= SimpleClassTime()

        fun add(hour:Int,minute:Int,lengthMinute:Int=45)=also{
            simpleClassTime.times.add(Pair(
                CalendarUtil.getSeconds(hour,minute),
                CalendarUtil.getSeconds(hour,minute)+lengthMinute*60))
        }

        fun build(): SimpleClassTime {
            return simpleClassTime
        }
    }
}